function DiscountRule() {
}

/**
 * 
 * @param {Object|Items}
 *            checkout
 */
DiscountRule.prototype.applyRule = function(items, total) {

};

function DiscountRule1() {
}

DiscountRule1.prototype = new DiscountRule();

/**
 * 
 * If you buy 2 or more lavender hearts then the price drops to £8.50. Product
 * code = 001
 * 
 */
DiscountRule1.prototype.applyRule = function(items, total) {
	var productCode = "001";
	var price = 8.50;

	for ( var i in items) {
		if (i == productCode) {
			if (items[productCode].quantity >= 2) {
				if (items[productCode].item.getPrice() > price) {
					return total
							- ((items[productCode].item.getPrice() - price) * items[productCode].quantity);
				}
			}
		}
	}

	return total;
};

function DiscountRule2() {
}

DiscountRule2.prototype = new DiscountRule();

/**
 * If you spend over £60, then you get 10% of your purchase
 */
DiscountRule2.prototype.applyRule = function(items, total) {

	if (total > 60) {
		return total * 0.9;
	} else {
		return total;
	}
};